import Vuex from 'vuex'
import Vue from 'vue'
Vue.use(Vuex)
const actions={
  add (context,value){
    console.log('actions--add',context,value)
    context.commit('ADD',value)
  }
}

const mutations={
  ADD(state,value){
    console.log('mutations-ADD',value)
    state.sum += value
  }
}

const state={
  sum:0,sname:'老杨'
}
const getters= {
  bigSum:function (state){
    return state.sum*10
  }
}

export default new Vuex.Store({
  actions,
  mutations,
  state,getters
});

